package org.jeecg.modules.clue.job;


import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.clue.service.IClueTaskPushDayReportService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 线索推送每日报表
 */
@Component
@Slf4j
@DisallowConcurrentExecution
public class ClueTaskPushDayReportJob implements Job {

    /**
     * 若参数变量名修改 QuartzJobController中也需对应修改
     */
    private String parameter;

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }

    @Resource
    IClueTaskPushDayReportService clueTaskPushDayReportService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("ClueTaskPushDayReportJob 定时任务");


        String dateStr = DateUtil.yesterday().toDateStr();
        if (StringUtils.isNotBlank(parameter)) {
            dateStr  = parameter;
        }
        clueTaskPushDayReportService.countByDate(dateStr);

    }


}
